
# Set up the packages, options, and working directory path
library(tidyverse)
library(scales)
set.seed(42)
options(scipen=999)
if (Sys.info()[['user']] == "alal") {
  root = "/home/alal/Dropbox/1_Research/ElecAdminFunding/ElecAdminFundingReplication"
  theme_set(lal_plot_theme())
} else {
  root = "~/Dropbox/ElecAdminFunding/ElecAdminFundingReplication"
  theme_set(theme_minimal())
}

# Plot the total CTCL grant spending by category in Wisconsin
fig_spend_cat = read_csv(file.path(root, "/original_data/wi_grant_spend_totals.csv")) %>%
  ggplot(aes(x = reorder(category, amount), y = amount)) + 
    geom_bar(stat = "identity", fill="#08519C") +
    scale_y_continuous(labels=comma, limits=c(0, 2075000)) +
    labs(x="", y="Total Spent in Wisconsin ($)") +
    theme(text = element_text(size=20, face="bold", color="black")) +
    theme(panel.grid.minor = element_blank()) +
    coord_flip()
ggsave(file.path(root, "output/spend_cats_wi.pdf"), plot=fig_spend_cat,
  width = 10, height = 8)
